//
//  ZMTest_1_Controller.m
//  testDemo
//
//  Created by 赵林瑞 on 16/7/18.
//  Copyright © 2016年 RZOL. All rights reserved.
//

#import "ZMTest_1_Controller.h"
#import "UIBarButtonItem+MTExtension.h"

@interface ZMTest_1_Controller ()
{
    UIView *_view;
}

@end

@implementation ZMTest_1_Controller

- (void)viewDidLoad {
    [super viewDidLoad];
    
    UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kScreeWith, 40)];
    UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(kScreeWith*0.15, 10, kScreeWith*0.7, 20)];
    label.textAlignment = NSTextAlignmentCenter;
    label.font = LAB_FONT(11);
    [label setTextColor:HEXCOLOR(0x999999)];
    [view addSubview:label];
    label.text = @"您还没有添加任何产品哦~";
    
    _view = view;
    
    self.tableView.tableHeaderView = _view;
    
    self.navigationItem.rightBarButtonItem = [UIBarButtonItem itemWithImage:nil highImage:nil titleString:@"帮助" titleColor:HEXCOLOR(0xdddddd) leftOrRight:NO target:self action:@selector(helpBtnClick)];
}

-(void)helpBtnClick
{
    _view.height = 0;
    
    UIView *view = [UIView new];
    view.frame = CGRectMake(0, 0, 0, 0);
    self.tableView.tableHeaderView = view;
    
    [self.tableView reloadData];
}

#pragma mark - Table view data source

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return 5;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell"];
    
    //
    if (!cell) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:@"cell"];
    }
    
    cell.textLabel.text = @"路飞，我的男神！";
    
    return cell;
}

@end
